package com.test.restassured;

import io.restassured.response.Response;

import static io.restassured.RestAssured.given;

public class GpathHtmlDemo {
    public static void main(String[] args) {
        Response response = given().when().get("https://www.baidu.com")
                .then().log().all().extract().response();

        // 获取title标签的文本
        Object result = response.htmlPath().get("html.head.title");
        System.out.println(result);

        // 获取所有link标签的href属性
        Object result1 = response.htmlPath().get("html.head.link.@href");
        System.out.println(result1);
    }
}
